Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-https

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-https

Check if the given request is HTTPS

  • 3.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
315K
increased by0.3%
Maintainers
1
Weekly downloads
 
Created

What is is-https?

The is-https npm package is a simple utility to check if a request is made over HTTPS. It is particularly useful in server-side applications where you need to ensure secure connections.

What are is-https's main functionalities?

Check if request is HTTPS

This feature allows you to check if an incoming request is made over HTTPS. The code sample demonstrates a simple HTTP server that responds differently based on whether the request is HTTPS or not.

const isHttps = require('is-https');
const http = require('http');

const server = http.createServer((req, res) => {
  if (isHttps(req)) {
    res.writeHead(200, { 'Content-Type': 'text/plain' });
    res.end('Request is HTTPS');
  } else {
    res.writeHead(400, { 'Content-Type': 'text/plain' });
    res.end('Request is not HTTPS');
  }
});

server.listen(3000, () => {
  console.log('Server running at http://localhost:3000/');
});

Other packages similar to is-https

FAQs

Package last updated on 18 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc